import { defineStore } from "pinia";
import { getMyInfo } from "@/api/user";


type state = {
    zlData:myInObj

}
export const useMy = defineStore(
    'my',
    {
        state:():state=>{
            return {
                zlData:{} as myInObj
            }
        },
        getters:{},
        actions:{
            async fetchMyData(){
                if(localStorage.getItem('userId')){
                    let res =await getMyInfo(localStorage.getItem('userId') as string);
                    this.zlData = res.data[0];
                }else{
                    return true;
                }
            }
        }
    }
)